

#ifndef __SIMULATION_I2C_H_
#define __SIMULATION_I2C_H_
#include <stdint.h>

//SCL -- PB1
#define SCL_PIN 				GPIO_PIN_8
#define SCL_GPIO_PORT			GPIOB
#define SCL_GPIO_CLK			RCM_AHB_PERIPH_GPIOB

//SDA -- PB0
#define SDA_PIN 				GPIO_PIN_9
#define SDA_GPIO_PORT			GPIOB
#define SDA_GPIO_CLK			RCM_AHB_PERIPH_GPIOB


#define SCL2_PIN 				GPIO_PIN_10
#define SCL2_GPIO_PORT			GPIOB
#define SCL2_GPIO_CLK			RCM_AHB_PERIPH_GPIOB


#define SDA2_PIN 				GPIO_PIN_11
#define SDA2_GPIO_PORT			GPIOB
#define SDA2_GPIO_CLK			RCM_AHB_PERIPH_GPIOB




void SCL_OUT(void);
void SDA_OUT(void);
void SDA_IN(void);
void I2C_SCL_H(void);
void I2C_SCL_L(void);
void I2C_SDA_H(void);
void I2C_SDA_L(void);

void i2c_Port_Init(void);
void I2C_Start(void);
void I2C_Stop(void);
void start(void);
void stop(void);
uint8_t r_ack(void);
void s_ack(void);
void s_nack(void);


void write_byte(unsigned char w_data);
unsigned char read_byte(void);

int cw_read(unsigned char PointReg, unsigned char * pData);
int cw_write(unsigned char PointReg, unsigned char * pData);
int cw_read_nbyte(unsigned char point_reg, unsigned char * r_pdata, unsigned char len);

void I2C_Delay10us(unsigned int us);
void cw_delay10us(unsigned int us);



#endif



